package com.me.darkness_is_coming.main;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.me.darkness_is_coming.screens.*;


public class MainGame extends Game
{
    private SpriteBatch batch;
    private MenuScreen menuScreen;
    private GameScreen gameScreen;
    private ScoreScreen scoreScreen;
    private PauseScreen pauseScreen;
    private RulesScreen rulesScreen;

    private static MainGame instance = new MainGame();

    private MainGame()
    {
    }

    public static MainGame getInstance()
    {
        return instance;
    }

    @Override
    public void create()
    {
        batch = new SpriteBatch();
        menuScreen = new MenuScreen(batch);
        gameScreen = new GameScreen(batch);
        scoreScreen = new ScoreScreen(batch);
        pauseScreen = new PauseScreen(batch);
        rulesScreen = new RulesScreen(batch);

        setScreen(menuScreen);
    }

    @Override
    public void dispose()
    {
        batch.dispose();
        menuScreen.dispose();
        gameScreen.dispose();
        scoreScreen.dispose();
        pauseScreen.dispose();
        rulesScreen.dispose();
    }

    public void resumeGame()
    {
        setScreen(gameScreen);
    }
    public void newGame()
    {
        if(!gameScreen.isclean())gameScreen.clean();
        setScreen(gameScreen);
    }


    public void showMenu()
    {
        setScreen(menuScreen);
    }

    public void showGame()
    {
        setScreen(gameScreen);
    }

    public void showScore()
    {
        setScreen(scoreScreen);
    }

    public void showPause()
    {
        setScreen(pauseScreen);
    }

    public void showRules()
    {
        setScreen(rulesScreen);
    }
}
